package shared.pojo

import shared.Pojo.AnalysisArg
import shared.tool.DefaultPickle
import upickle.default._

/** Created by yz on 30/8/2023
  */
package object mission {

  case class PlotKindData(kind: String, id: Int, idStr: String = "", prefix: String = "")

  object PlotKindData {
    implicit val rw = macroRW[PlotKindData]
  }

  object GetFileData {

    case class Request(fileName: String, id: String)

    object Request {
      implicit val rw = macroRW[Request]
    }

  }

  case class PlotConfigDataRequest(
      id: Int,
      fileName: String,
      idStr: String = ""
  )

  object PlotConfigDataRequest {
    implicit val rw = macroRW[PlotConfigDataRequest]

  }

  case class BoxplotSoftData(
      kind: String = "boxplot",
      missionName: String = "",
      file: String = "",
      groupFile: String = "",
      method: String = "auto",
      isPaired: Boolean = false
  ) extends AnalysisArg

  object BoxplotSoftData {
    implicit val rw = macroRW[BoxplotSoftData]
    implicit val defaultRw = DefaultPickle.macroRW[BoxplotSoftData]
  }

  case class KeggEnrichSoftData(
      kind: String = "keggEnrich",
      missionName: String = "",
      file: String = "",
      hasGroup: Boolean = false,
      groupFile: String = "",
      fcMethod: String = "auto",
      species1: String = "Mammals",
      species: String = "hsa",
      isSmp: String = "kegg",
      method: String = "hyperg",
      nodeImp: String = "dgr"
  ) extends AnalysisArg

  object KeggEnrichSoftData {
    implicit val rw = macroRW[KeggEnrichSoftData]
    implicit val defaultRw = DefaultPickle.macroRW[KeggEnrichSoftData]
  }

  case class HeatmapSoftData(
                              kind: String = "heatmap",
                              missionName: String = "",
                              file: String = "",
                              hasRowGroup:Boolean=false,
                              rowGroupFile:String="",
                              selectColumns:List[String]=List.empty,
                              hasColGroup: Boolean = false,
                              colGroupFile: String = "",
                               ) extends AnalysisArg

  object HeatmapSoftData {
    implicit val rw = macroRW[HeatmapSoftData]
    implicit val defaultRw = DefaultPickle.macroRW[HeatmapSoftData]
  }

  case class ViolinPlotSoftData(
      kind: String = "violinPlot",
      missionName: String = "",
      file: String = "",
      groupFile: String = "",
      isPaired: Boolean = false,
      method: String = "auto"
  ) extends AnalysisArg

  object ViolinPlotSoftData {
    implicit val rw = macroRW[ViolinPlotSoftData]
    implicit val defaultRw = DefaultPickle.macroRW[ViolinPlotSoftData]
  }

  case class StampSoftData(
      kind: String = "stamp",
      missionName: String = "",
      file: String = "",
      groupFile: String = "",
      group: String = "",
      qValueCutoff: String = "0.05",
      adjustMethod: String = "fdr"
  ) extends AnalysisArg

  object StampSoftData {
    implicit val rw = macroRW[StampSoftData]
    implicit val defaultRw = DefaultPickle.macroRW[StampSoftData]
  }

  case class HorizontalBoxplotSoftData(
      kind: String = "horizontalBoxplot",
      missionName: String = "",
      file: String = "",
      groupFile: String = "",
      method: String = "auto",
      isPaired: Boolean = false
  ) extends AnalysisArg

  object HorizontalBoxplotSoftData {
    implicit val rw = macroRW[HorizontalBoxplotSoftData]
    implicit val defaultRw = DefaultPickle.macroRW[HorizontalBoxplotSoftData]
  }

  object CanPaired {

    case class Request(file: String, groupFile: String)

    object Request {

      implicit val rw = macroRW[Request]

    }

  }

}
